<?php

namespace App\Modules\Admin\Services\System;

use App\Modules\Admin\Entities\System\FeedbackModel;
use App\Modules\Apicrzs\Services\BaseServices;
use Illuminate\Support\Facades\DB;
// 投诉反馈

class FeedbackService extends BaseServices
{

    public function __construct(FeedbackModel $dictModel)
    {
        $this->model = $dictModel;
        $this->with=['user_info'];
    }
    public function lists(array $params) : array
    {
        $params['where_callback'] = function ($query) use ($params) {
            $request = request();
            if (!empty($dict_type = $request->input('dictType', ''))) {
                $query->where('company_name',$dict_type);
            }
        };
        $params['order']='id';
        $params['order_sort']='desc';
        $lists = parent::lists($params);
        return $lists; // TODO: Change the autogenerated stub
    }

    public function update(array $params)
    {
        DB::beginTransaction();
        try{
            parent::update($params); // TODO: Change the autogenerated stub

            DB::commit();
            return true;
        }catch (\App\Exceptions\Exception $e){
            DB::rollBack();
            throw new Exception($e->getMessage());
        }
    }


}
